<template>
  <view class='news-detail' v-cloak>
    <view class="detail-h1">{{info.name}}</view>
    <view class="detail-user">
      <image :src="info.authorAvater" class='user-img' mode='widthFix'></image>
      <view class="user-info">
        <view class="info-h2">{{info.author}}</view>
        {{info.releaseTime}}
      </view>
    </view>
    <view class="detail-main" v-html="info.content"></view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        info:{}
      };
    },
    onLoad(ops) {
      this.$get(`/news/app/newsArticle/fineNewsWebArticle/${ops.id}`).then(res=>{
        if(res.code == '1'){
          this.info = {
            ...res.content,
            content:res.content.content.toString().replace(/\<img\s+/gi, `<img style="max-width:100%" mode="widthFix" `)
          }
        }
      })
    }
  }
</script>

<style lang="less" scoped>
.news-detail{
  min-height: 100vh;
  background: #fff;
  padding: 24rpx 32rpx;
  box-sizing: border-box;
  .detail-h1{
    font-size: 48rpx;
    font-weight: 500;
    color: #000000DE;
  }
  .detail-user{
    margin: 32rpx 0;
    display: flex;
    align-items: center;
    .user-img{
      width: 64rpx;
      height: 64rpx;
      margin-right: 16rpx;
    }
    .user-info{
      font-size: 20rpx;
      color: #00000061;
      .info-h2{
        font-size: 24rpx;
        color: #000000DE;
      }
    }
  }

  .detail-main{
    font-size: 28rpx;
  }
}
</style>
